package com.szw.easyquotation.constant;

import javax.annotation.PostConstruct;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;


@Component
public class ServicesUrl {
	private final Logger log = Logger.getLogger(ServicesUrl.class);

	@Value("${python.webservice.url}")
	private String pythonWebserviceUrl;
	private String getAllMarketDataUrl;
	private String createNewTableJobUrl;
	private String getDailyKLineUrl;

	@PostConstruct
	public void Init() {
		this.getAllMarketDataUrl = this.pythonWebserviceUrl + "/getAllMarketData";
		this.createNewTableJobUrl = this.pythonWebserviceUrl + "/createNewTableJob?interval=";
		this.getDailyKLineUrl = this.pythonWebserviceUrl + "/getDailyKLine?stockcode=";
		JSONObject obj = new JSONObject();
		obj.put("pythonWebserviceUrl", pythonWebserviceUrl);
		obj.put("getAllMarketDataUrl", getAllMarketDataUrl);
		obj.put("createNewTableJobUrl", createNewTableJobUrl);
		obj.put("getDailyKLineUrl", getDailyKLineUrl);
		log.info("[servicesUrl初始化...]结果：" + obj.toJSONString());
	}

	public String getGetAllMarketDataUrl() {
		return getAllMarketDataUrl;
	}

	public String getCreateNewTableJobUrl() {
		return createNewTableJobUrl;
	}

	public String getGetDailyKLineUrl() {
		return getDailyKLineUrl;
	}

}
